package com.yy.wga.user.service.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author lgw
 * @version JDK 8
 * @date 2025/3/14
 * @description 用户等级变更记录类型
 */
@AllArgsConstructor
@Getter
public enum GradeRecordType {
    UP_GRADE(1, "达到升级条件"),
    BUY_GOODS_UP(2, "购买直通车礼包"),
    UPDATE_GRADE(3, "修改等级"),
    ;

    private final Integer type;
    private final String desc;

    /**
     * 是否枚举
     *
     * @param type 类型
     * @return
     */
    public static GradeRecordType getByType(Integer type) {
        if (type != null) {
            for (GradeRecordType yesOrNoType : GradeRecordType.values()) {
                if (yesOrNoType.getType().equals(type)) {
                    return yesOrNoType;
                }
            }
        }
        return null;
    }
}
